<template>
	<view class="content">
		<!-- <view class="search">
			<insput v-model="searchs" type="text" value="" placeholder="请输入要搜索的商品" />
		</view>
		 -->
		<view class="zuix">
			
		<view class="imag" v-for="item in storys" :key='item.id'>
				<image :src="item.goods_image" mode="widthFix" @tap='shopinfo(item.id)'></image>
				<text class="x">{{item.title}}</text>
				<view class="f">{{item.title_f}}</view>
				<view class="" style="display: flex;">
					<text class="price">￥{{item.price}}</text>
					<text class="price_q">￥{{item.oldprice}}</text>
				</view>
				<view class="lms">
					<text>销量{{item.xl}}笔</text>
					<image src="../../../static/images/s21.png" mode="widthFix" @tap='shopping(item.id)'></image>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//地方特色
				storys:[]
			
			}
		},
		onLoad() {
			this.story()
		},
		methods: {
			shopping(id){
				this.$ajax(
				this.apiList.cart,
				{
					gid:id
				},
				'POST',
				).then(res=>{
				this.$sToast(res.msg)
				})
			},
			story(){
				this.$ajax(
				this.apiList.story,
				{
					page:1
				},
				'POST',
				).then(res=>{
			this.storys = res.data
				})
			},
			shopinfo(id){
				uni.navigateTo({
					url:'../../details/details?id='+id
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
.content{
	width: 100%;
	height: 100%;
	background-color: #eee;
	box-sizing: border-box;
	 & .search{
		 width: 100%;
		 box-sizing: border-box;
		 text-align: center;
		 height: 88upx;
		 padding: 20upx 0;
		 position: fixed;
		 left: 0;
		 top:88upx;
		 z-index: 99;
		 background-color: #eee;
		 & input {
			 position: fixed;
			 left: 4%;
			 z-index: 999;
			 display: inline-block;
			 width:690upx;
			 height:48upx;
			 background:#fff !important;
			 opacity:1;
			 border-radius:40px;
		 }
	}
	& .zuix {
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
		padding: 0upx 30upx 30upx 30upx;
		width: 100%;
		height: 100vh;
		overflow-y: scroll;
		box-sizing: border-box;
		background-color: #eee;
		flex-wrap: wrap;
		.imag {
			width: 335upx;
			background-color: #fff;
			margin-bottom: 30upx;
	
			image {
				width: 100%;
			}
	
			.x {
				display: block;
				width: 100%;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 700;
				margin: 10upx;
			}
			.f{
				width: 70%;
				font-size: 28rpx;
				overflow: hidden;
				color: #C0C0C0;
				flex-wrap: nowrap;
				margin-left: 20upx;
				white-space:nowrap;
				text-overflow: ellipsis;
			}
	
			.price {
				display: block;
				width: 100%;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: rgba(226, 104, 27, 1);
				margin: 10upx;
			}
	
			.price_q {
				display: block;
				width: 100%;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 400;
				text-decoration: line-through;
				color: rgba(112, 112, 112, 1);
				margin: 10upx;
			}
	
			.lms {
				display: flex;
				justify-content: space-between;
				width: 100%;
				padding-bottom: 20rpx;
				text {
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 400;
					margin-bottom: 10upx;
					margin-left: 10upx;
				}
	
				image {
					width: 40rpx;
					height: 40rpx;
					margin-right: 10upx;
				}
			}
		}
	}
	& .bac {
		background: url(../../../static/images/s35.png) no-repeat center ;
		background-size: 50% ;
		background-position: 50% 20%;
		}
	}
</style>
